package com.cazor.mg.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cazor.mg.domain.MgDevice;
import com.cazor.mg.mapper.MgDeviceMapper;
import com.cazor.mg.service.IMgDeviceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 设备Service业务层处理
 *
 * @author cazor
 * @date 2023-11-23
 */
@Service
public class MgDeviceServiceImpl extends ServiceImpl<MgDeviceMapper, MgDevice> implements IMgDeviceService
{
    @Resource
    private MgDeviceMapper mgDeviceMapper;

    /**
     * 查询设备
     *
     * @param id 设备主键
     * @return 设备
     */
    @Override
    public MgDevice selectMgDeviceById(Long id)
    {
        return mgDeviceMapper.selectMgDeviceById(id);
    }

    /**
     * 查询设备列表
     *
     * @param mgDevice 设备
     * @return 设备
     */
    @Override
    public List<MgDevice> selectMgDeviceList(MgDevice mgDevice)
    {
        return mgDeviceMapper.selectMgDeviceList(mgDevice);
    }

    /**
     * 新增设备
     *
     * @param mgDevice 设备
     * @return 结果
     */
    @Override
    public int insertMgDevice(MgDevice mgDevice)
    {
//        mgDevice.setCreateTime(DateUtils.getNowDate());
        return mgDeviceMapper.insertMgDevice(mgDevice);
    }

    /**
     * 修改设备
     *
     * @param mgDevice 设备
     * @return 结果
     */
    @Override
    public int updateMgDevice(MgDevice mgDevice)
    {
//        mgDevice.setUpdateTime(DateUtils.getNowDate());
        return mgDeviceMapper.updateMgDevice(mgDevice);
    }

    /**
     * 批量删除设备
     *
     * @param ids 需要删除的设备主键
     * @return 结果
     */
    @Override
    public int deleteMgDeviceByIds(Long[] ids)
    {
        return mgDeviceMapper.deleteMgDeviceByIds(ids);
    }

    /**
     * 删除设备信息
     *
     * @param id 设备主键
     * @return 结果
     */
    @Override
    public int deleteMgDeviceById(Long id)
    {
        return mgDeviceMapper.deleteMgDeviceById(id);
    }
}
